# -*- coding: utf8 -*-
from __future__ import absolute_import
import datetime
#from webapp2_extras.i18n import lazy_gettext as _
#from webapp2_extras.i18n import lazy_gettext as gettext
import webapp2
from jinja2 import Environment, PackageLoader, FileSystemLoader, MemcachedBytecodeCache
#from webapp2_extras import i18n
import os
# install the root path as the template path
# template should be referred by the their full name
# eg application wide/base template - > templates/{template file}
# package templates -> packages/{package name}/templates/{template file}
template_root = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
template_env = Environment(
    loader=FileSystemLoader(template_root),
    extensions=['jinja2.ext.i18n'],
    auto_reload=True,  # do check if the source changed
    trim_blocks=True  # first newline after a block is removed
    # This does not work (yet):
    # <type 'exceptions.RuntimeError'>: disallowed bytecode
)

#template_env.filters.update({
#    # Set filters.
#    # ...
#})
template_env.globals.update({
    'uri_for': webapp2.uri_for,
})
